<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>三角形</title>
</head>

<body>


</body>
  <script>
	var t=prompt("请输入一个整数：","")
	if(t>5)
	{
		for(var i=t;i>0;i--)
		{
			for(var j=0;j<i;j++)
			{
				document.write("*&nbsp&nbsp");
			}
			document.write("<br>");
		}
	}
	else
	{
		for(var k=t;k>0;k--)//行
		{
			for(var m=0;m<k;m++)//列
			{
				document.write("*&nbsp&nbsp");//个数由列决定
			}
			document.write("<br>");
		}
		for(var n=1;n<=t;n++)
		{
			for(var h=0;h<n;h++)
			{
				document.write("*&nbsp&nbsp");
			}
			document.write("<br>");
		}
	}
  </script>
</html>
